<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%@ include file="/pub/head_bootstrap.inc"%>
 
<title>登录日志</title>

<style>
 
</style>
</head>
<body>
		<div class="FrameRight">
			<div class="main" >
				<div>
					<form id="formsearch" method="post">
						<div class="selector-form"></div> 
					</form> 
				</div> 
				
				<div class="common-option" style="margin-top: 5px">
					<div class="inner">
						<c:if test="${type == 0}">
						<button id="add" type="button" class="btn btn-icon"
							onclick="SHOW_HISTORY()">
							<i class="l-icon l-icon-a fa bd bd-angle-right">历史登录日志</i>
						</button>
						</c:if>
						
						<c:if test="${type == 1}">
						<button id="add" type="button" class="btn btn-icon"
							onclick="SHOW_CURRENT()">
							<i class="l-icon l-icon-a fa bd bd-angle-left">在线用户</i>
						</button>
 					</c:if>
					</div>
					
				</div>
				<div class="common-table">
					<table id="maingrid" class="table"></table>
				</div>
			</div>
		</div>
		<%@ include file="/web/common/selector/selector_form.jsp" %>
	<script type="text/javascript">
	
       //列表结构
      /* var grid = $("#maingrid").ligerGrid({ 
          columns: [
          {display:"登录帐号",name:"logonId",width:150,type:"text",align:"center",isSort : true},
          {display:"用户名",name:"userName",width:165,type:"text",align:"center",isSort : true},
          {display:"IP地址",name:"ip",width:120,type:"int",align:"center",isSort : false},
          {display:"登录时间",name:"logonDate",width:140,type:"text",align:"center",isSort : true},
          {display:"在线时长",name:"onlineTime",width:120,type:"text",align:"center",isSort : true},
          {display:"注销时间",name:"logoutDate",width:140,type:"text",align:"center",isSort : true}, 
          //{display:"是否登录成功",name:"isLogInDesc",width:80,type:"text",align:"center",isSort : false}, */
         // {display:"是否退出成功",name:"isLogOutDesc",width:80,type:"text",align:"center",isSort : false},
          //{display:"登录异常",name:"loginErrorMsg",width:500,type:"text",align:"center",isSort : true},
          //{display:"退出异常",name:"logoutErrorMsg",width:500,type:"text",align:"center",isSort : true},
          /* {display:"详细日志",name:"logDetailS",width:150,type:"text",align:"center",isSort : false,
        	  render:function(rowdata,rowindex,value){
        		  var html = "<span title='"+rowdata.logDetail+"'>"+value+"</span>";
        		  return html;
        	  }}, */
          /* {display:"状态",name:"statusStr",width:100,type:"text",align:"center",isSort : true},
          {display:"操作类型",name:"operation",width:100,type:"text",align:"center",isSort : true},
          {display:"日志类型",name:"logType",width:100,type:"text",align:"center",isSort : true}, 
          {display:"失败信息",name:"failLog",width:100,type:"text",align:"center",isSort : true}, 
          {display:"完成时间",name:"finishDate",width:100,type:"text",align:"center",isSort : true},  */
          /* ],
          dataAction: 'server',
          url: '${baseURL}/system/security/logonloglist/listJSON.do?rand='+Math.random(), sortName: 'code',
          width: '98%', height: '100%',heightDiff:-10, 
          pageParmName:"pageNo",pageSizeOptions:[${pageOptions}],pagesizeParmName:"perPageSize",
          rowHeight:23,rownumbers:true,isScroll:true,sortnameParmName:"sortName",
          sortorderParmName:"sortOrder",checkbox:false,pageSize: ${pageSize}
      }); */

      //搜索表单应用ligerui样式
       //$("#formsearch").ligerForm();
      
       /* $(function(){
	   		$(document).keypress(function(event){
	   			if (event.keyCode == 13) { // 13表示回车键
	   				$("#btnSearch").click();
	   				return false;
	   			}
	   		});
       }); */
      
      /* $("#btnSearch").click(function(e){
    	  var json = LG.bulidFilterParams($("#formsearch"));
           grid.set('parms', json);
            //采用原来的请求地址，带上参数加载数据
            grid.changePage('first');
		   grid.loadData();
      }); */
      
      /* $("#btnReset").click(function(e){
           grid.set('parms', null);
           //采用原来的请求地址，带上参数加载数据
           grid.changePage('first');
		   grid.loadData();
      }); */

      /* $("#module").ligerComboBox({
  		 width: 180,
          selectBoxWidth: 180,
          selectBoxHeight: 200, valueField: 'text',treeLeafOnly:false,
          tree: { data: ${menuArray}, checkbox: false}
      }); */
          function main(){
    	  var pageSize = 20;
    	  if('${pageSize}' != '')
    		  pageSize = '${pageSize}';
    	  
    	   var pageList = [20,50,100];
    	   if('${pageOptions}' != ''){
    		   pageList = '${pageOptions}';
    		   pageList = pageList.split(",");
    	   }
    	  
     	  $('#maingrid').bootstrapTable({
	       		url: "${baseURL}/syslog/syslog/logonlog/listJSON.do?type='${type}",
	       		method: 'post',
	       		sidePagination: "server",
	       		dataType:'json',
	       		dataField: 'Rows',
	       		totalField: 'Total',
	       		contentType:'application/x-www-form-urlencoded',
	       		queryParamsType:"undefined",
	       		queryParams: queryParams,
	            striped: true,                    
	            pagination: true,					//是否显示分页信息
	            pageNumber:1,                       
                pageSize: pageSize,                       
                pageList: pageList,     
  	            clickToSelect: true,                
	            uniqueId: "id",                 
 	       		columns: [/* {
	 	               field: 'checkbox',
		 	           checkbox: true
		           }, */ {
	                   field: 'number',
	                   title: '序号',
  	                   formatter: function (value, row, index) {
  	                   return (index+1);  
  	               }
	               }, {
	                   field: 'logonId',
	                   title: '登陆名'
	               }, { 
	                   field: 'userName',
	                   title: '用户名'
	               }, {
	                   field: 'ip',
	                   title: 'IP地址'
	               }, {
	                   field: 'logonDate',
	                   title: '登录时间'
	               }, {
	                   field: 'onlineTime',
	                   title: '在线时长'
	               },
	               <c:if test="${type == 1}">
	               {
	                   field: 'logoutDate',
	                   title: '注销时间'
	               }
	               </c:if>
	               ]
			})
      }
      function queryParams(params){
    		//获取搜索组件选择值
		    var obj = getSelectorValue();
			//加入分页参数
	        obj['perPageSize']= params.pageSize;
	        obj['pageNo']=params.pageNumber;
	        //获取搜索组件外搜索内容，遍历加到obj中
	     	var data = BT.buildFilterParams($("#formsearch"));
	        for(var key in data){
	        	obj[key]= eval("(data['"+key+"'])");
	        }
	        return obj;
      }
      var maingrid;
      $(function(){
    	  main();
    	  maingrid=$('#maingrid');
      })
      initData($(".selector-form"),
    			[
    				{id:"name",name:"登陆名/用户名",value:"",isExtended:false,selectType:1}
    	    	],[
    	    		
    	    	],"");
      $(function(){
  		renderSelector(getCurrentSelector());
  		initSearchGrid($("#maingrid"),'${baseURL}/syslog/syslog/logonlog/listJSON.do?type=${type}');
  	}); 
      
      function SHOW_HISTORY(){
  			parent.f_addTab("HistoryLogonLog", '历史登录日志', '${baseURL}/syslog/syslog/logonlog/newListLogonLog.do?type=1&menuId=${param.menuId}');
      }
      
      function SHOW_CURRENT(){
    		parent.f_addTab("${param.menuId}", '在线用户', '${baseURL}/syslog/syslog/logonlog/newListLogonLog.do?type=0&menuId=${param.menuId}');
     }
  </script>

</body>
</html>
